cmake_minimum_required (VERSION 2.6)
project (cse232fa13)

if( ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
  set(Boost_DIR "windowsCompatability/boost_windows")
  set(BOOST_INCLUDEDIR "windowsCompatability/boost_windows/boost_subset")
  set(BOOST_LIBRARYDIR "windowsCompatability/boost_windows/boost_libs")
  set(Boost_USE_STATIC_LIBS ON)
  set(Boost_USE_MULTITHREADED ON)
  set(Boost_USE_STATIC_RUNTIME ON)
  set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "windowsCompatability/boost_windows/boost_subset")
  set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "windowsCompatability/boost_windows/boost_libs/stage/lib")
  set(Boost_NO_SYSTEM_PATHS ON)
  set(BOOST_ROOT /windowsCompatability/boost_windows/boost_1_54_0)
  set(BOOST_INCLUDEDIR /windowsCompatability/boost_windows/boost_subset)
  set(BOOST_LIBRARYDIR /windowsCompatability/boost_windows/boost_libs/stage/lib)
  #set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "Boost")
  find_package(Boost COMPONENTS thread date_time program_options filesystem system serialization REQUIRED HINTS "windowsCompatability/boost_windows")
else()
  set(Boost_USE_STATIC_LIBS OFF)
  set(Boost_USE_MULTITHREADED ON)
  set(Boost_USE_STATIC_RUNTIME OFF)
  find_package(Boost 1.54.0 COMPONENTS filesystem regex)
  find_package(Boost COMPONENTS thread date_time program_options filesystem system serialization REQUIRED)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")

find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
#find_package(Boost COMPONENTS thread date_time program_options filesystem system serialization REQUIRED)

# Compile external dependencies 
#add_subdirectory (external)

include_directories(
        .
)

if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(CMAKE_EXE_LINKER_FLAGS
	-static
set(BOOST_USE_STATIC_LIBS ON)
set(BOOST_USE_STATIC_RUNTIME ON)
)

#Not sure if this is necessary?
#find_library(WIN_BOOST_VAR Boost /windowsCompat/boost_windows/boost_libs)

endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")

set(ALL_LIBS
        ${OPENGL_LIBRARY}
	${GLUT_LIBRARY}
	${Boost_LIBRARIES}
)

add_definitions(
        -DTW_STATIC
        -DTW_NO_LIB_PRAGMA
        -DTW_NO_DIRECT3D
        -DGLEW_STATIC
        -D_CRT_SECURE_NO_WARNINGS
)

add_executable(client_test
  windowsCompat/boost_windows/client_test.cpp
)

target_link_libraries(client_test
  ${Boost_LIBRARIES}
)

add_executable(round1game
	round1game/go.cpp
	round1game/glOutput/Graphics.h
	round1game/glOutput/Graphics.cpp
	
	round1game/GameController.h
	round1game/GameController.cpp

	round1game/situationControl/SituationController.h
	round1game/situationControl/SituationController.cpp
	round1game/situationControl/Situation.h
	round1game/situationControl/Situation.cpp
	round1game/situationControl/Player.h
	round1game/situationControl/Player.cpp
	round1game/situationControl/Room.h
	round1game/situationControl/Room.cpp
	round1game/situationControl/Drone.h
	round1game/situationControl/Drone.cpp
	round1game/situationControl/Shot.h
	round1game/situationControl/Shot.cpp

	round1game/networkIO/networkHandler.cpp
	round1game/networkIO/networkHandler.h

	round1game/keyboard_input/KeyboardHandler.h
	round1game/keyboard_input/KeyboardHandler.cpp
	round1game/keyboard_input/Settings.h
	round1game/keyboard_input/Settings.cpp
)

add_executable(gameClient
	round1game/networkIO/networkHandler.cpp
	round1game/networkIO/networkHandler.h
	round1game/networkIO/clientDriver.cpp
	#round1game/situationControl/SituationController.cpp
	#round1game/situationControl/SituationController.h
	round1game/situationControl/Situation.cpp
	round1game/situationControl/Situation.h
	round1game/situationControl/Player.h
	round1game/situationControl/Player.cpp
	round1game/situationControl/Room.h
	round1game/situationControl/Room.cpp
	round1game/situationControl/Drone.h
	round1game/situationControl/Drone.cpp
	round1game/situationControl/Shot.h
	round1game/situationControl/Shot.cpp
	#round1game/glOutput/Graphics.h
	#round1game/glOutput/Graphics.cpp
	#round1game/keyboard_input/KeyboardHandler.h
	#round1game/keyboard_input/KeyboardHandler.cpp
	#round1game/keyboard_input/Settings.h
	#round1game/keyboard_input/Settings.cpp 
)

add_executable(gameServer 
	round1game/networkIO/server/gameServer.cpp
	round1game/networkIO/server/gameServer.h
	round1game/networkIO/server/serverDriver.cpp
	round1game/situationControl/Situation.cpp
	round1game/situationControl/Situation.h
	round1game/situationControl/Player.h
	round1game/situationControl/Player.cpp
	round1game/situationControl/Room.h
	round1game/situationControl/Room.cpp
	round1game/situationControl/Drone.h
	round1game/situationControl/Drone.cpp
	round1game/situationControl/Shot.h
	round1game/situationControl/Shot.cpp
)

target_link_libraries(round1game
	${OPENGL_LIBRARY}
	${GLUT_LIBRARY}
	${Boost_LIBRARIES}
)

target_link_libraries(gameServer
	${Boost_LIBRARIES}
)

target_link_libraries(gameClient
	${OPENGL_LIBRARY}
	${GLUT_LIBRARY}
	${Boost_LIBRARIES}
)


# Left this example of how to copy an executable to a specific directory
#add_custom_command(
#   TARGET demo POST_BUILD
#   COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/demo${CMAKE_EXECUTABLE_SUFFIX}" "${CMAKE_CURRENT_SOURCE_DIR}/demo/"
#)

